<template>
	<view class="remine-thing">
		<view class="per-inform" >
			<view class="gongzi">我的工资单</view>
			<my-tag :value="CPchoicedTime" icon @click="choiceTime">11</my-tag>
		</view>
		<itmister-date-picker :ishalf="false" :isdays="false" ref="datePicker"  @dateConfirm="confirpicker"></itmister-date-picker>
		<view v-if="remainThingData.length==0" class="data-tip">没有待审核的内容</view>
		<view class="lay-remain">
			<remainThingCard :propMsg='item.message' type='salary' :rusult="item.data.hvo.approve_note"
				v-for="(item,index) in remainThingData" :key='index' class="remain-card"
				@handleClick='handleClick(item)' bgColor="#bd8b0b" :isShowBtn='isShowBtn' :salaryTableType='item.data.hvo.pk_wa_class.name'></remainThingCard>
		</view>
	</view>
</template>

<script>
	import apiData from '../../../common/utils/apiData.js'
	import service from '../../../common/service/new_file.js'
	export default {
		data() {
			return {
				monthValue:'',
				yearValue:'',
				remainThingData: [],
				ischeck:'Y',
				isShowBtn: true,
				isExamine:1,//是否审批
				timeObj:{
					startTime:'',
					endTime:'',
				}
			};
		},
		methods: {
			confirpicker(value){
				let splStr = value.date.split('-')
				this.monthValue =splStr[1]<10?'0'+splStr[1]:splStr[1]
				this.yearValue = splStr[0]
				this.getSalaryList()
			},
			choiceTime(){
				this.$refs.datePicker.show()
			},
			// restSearch(){
			// 	this.timeObj ={
			// 		startTime:'',
			// 		endTime:''
			// 	}
			// 	this.defaultIndex = 0
			// 	this.getSalaryList()
			// },
			// confirmDate(value){
			// 	this.yearValue = value[0]
			// 	this.monthValue= value[1]
			// 	this.getSalaryList()
			// },
			handleClick(item) {
				let month = item.message.split('[')[1].split(']')[0]
				uni.navigateTo({
					url: './salaryExamine?item=' + JSON.stringify(item.data) + '&month=' + month+'&isExamine=' + this.isExamine
				})
			},
			getSalaryList() {
				let _this = this
				let date ={
					year:this.yearValue,
					month:this.monthValue
				}
				let data = apiData.setSalaryList('6302',this.ischeck,date,'0') //工资列表
				service.common(data, {
					success: function(res) {
						// uni.setStorageSync('salaryRemineData',JSON.stringify(res.data.VALUES))
						if(res.data.VALUES){
							_this.isExamine='0'
							_this.remainThingData = res.data.VALUES
							
						}
					}
				})
			},
		},
		computed:{
			CPchoicedTime(){
				if(this.yearValue==''&&this.monthValue==''){
					return '全部'
				}{
					return this.yearValue+'-'+this.monthValue
				}
				}
		},
		onPullDownRefresh() {
			this.getSalaryList()
		},
		onReady() {
			
		},
		onLoad() {
			// let nowDate = new Date
			// this.monthValue = (nowDate.getMonth()+1)<10?'0'+(nowDate.getMonth()+1):(nowDate.getMonth()+1)
			// this.yearValue = nowDate.getFullYear().toString()
			this.getSalaryList()
		},
		
	}
</script>

<style lang="scss" scoped>
	.per-inform{
		padding: 0 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 88rpx;
		border-bottom: 2rpx solid #ececec;
		.gongzi{
			font-size: 28rpx;
			font-weight: 600;
			color: #0089FF;
		}
	}
	.head {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 30rpx;
		padding-top: 120rpx;
		.search-btn{
			font-size: 28rpx;
			padding-left: 10rpx;
		}
		.search{
			flex: 1;
		}
	}
	.lay-remain {
		padding-top: 180rpx;
		.remain-card {
			margin: 30rpx 36rpx;
		}
	}

	.data-tip {
		text-align: center;
		color: #949494;
		padding-top: 300rpx;
		font-size: 28rpx;
	}
</style>
